package com.koi.desensitize.anno;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.koi.desensitize.config.DesensitizeJsonSerializer;
import com.koi.desensitize.enums.DesensitizeRuleEnum;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author ･ᴗ･
 * @description [KoiDesensitize]
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@JacksonAnnotationsInside
@JsonSerialize(using = DesensitizeJsonSerializer.class)
public @interface KoiDesensitize {

    /**
     * 脱敏数据类型，在MY_RULE的时候，startInclude和endExclude生效
     */
    DesensitizeRuleEnum rule() default DesensitizeRuleEnum.KOI_RULE;

    /**
     * 脱敏开始位置（不包含）
     */
    int beginExclude() default 0;

    /**
     * 脱敏结束位置（包含）
     */
    int endInclude() default 0;

}
